package com.tiennt.android.chinesechess.models.quanco;

import android.graphics.Canvas;
import android.graphics.Paint;

import com.tiennt.android.chinesechess.models.BanCo;
import com.tiennt.android.chinesechess.models.BitmapHolder;
import com.tiennt.android.chinesechess.ui.UIPainter;

public class QuanPhao extends QuanCo {

	public QuanPhao(BanCo banCo, int hang, int cot, String ten,
			int phe, int thutu, int trangthai) {
		mTenThat = QuanCo.cQUANPHAO;
		
		mBanCo = banCo;
		mHang = hang;
		mCot = cot;
		mTen = ten;
		mThuTu = thutu;
		mTrangThai = trangthai;
		mPhe = phe;
		
		mBanCo.mOCo[mHang][mCot].mQuanCo = this;
	}

	@Override
	public void drawItself(Canvas canvas, Paint paint, BanCo banCo) {
		// TODO Auto-generated method stub
		if (mPhe == QuanCo.cPHE_DEN) {
			switch (mTrangThai) {
			case QuanCo.cTRANGTHAI_NORMAL:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.PHAO_DEN_NORMAL));
				break;
			case QuanCo.cTRANGTHAI_BIAN:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.PHAO_DEN_BIAN));
				break;
			case QuanCo.cTRANGTHAI_MARKED:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.PHAO_DEN_MARKED));
				break;
			case QuanCo.cTRANGTHAI_UP:
				UIPainter.drawQuanCo(canvas, mCot, mHang,
						mBanCo.mBitmapHolder.getBitmap(BitmapHolder.TenQuanCo.UP_DEN));
				break;
			case QuanCo.cTRANGTHAI_UP_MARKED:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.UP_DEN_MARKED));
				break;
			default:
				break;
			}
		} else {
			switch (mTrangThai) {
			case QuanCo.cTRANGTHAI_NORMAL:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.PHAO_DO_NORMAL));
				break;
			case QuanCo.cTRANGTHAI_BIAN:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.PHAO_DO_BIAN));
				break;
			case QuanCo.cTRANGTHAI_MARKED:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.PHAO_DO_MARKED));
				break;
			case QuanCo.cTRANGTHAI_UP:
				UIPainter.drawQuanCo(canvas, mCot, mHang,
						mBanCo.mBitmapHolder.getBitmap(BitmapHolder.TenQuanCo.UP_DO));
				break;
			case QuanCo.cTRANGTHAI_UP_MARKED:
				UIPainter.drawQuanCo(canvas, mCot, mHang, mBanCo.mBitmapHolder
						.getBitmap(BitmapHolder.TenQuanCo.UP_DO_MARKED));
				break;
			default:
				break;
			}
		}
	}

}
